package poi;

import org.apache.poi.hssf.extractor.ExcelExtractor;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;


import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.Date;

public class TextExtraction {
    final static String filepath="workbook.xls";

    public static void main(String[] args) throws  Exception{
        FileOutputStream fos=new FileOutputStream(filepath);
        HSSFWorkbook workbook=new HSSFWorkbook();

        HSSFSheet sheet=workbook.createSheet();
        HSSFRow row=sheet.createRow(0);

        HSSFCell cell=row.createCell(0);

        cell.setCellValue(new Date());
        HSSFCellStyle style=workbook.createCellStyle();
        style.setDataFormat(HSSFDataFormat.getBuiltinFormat("d-mmm-yy"));
        cell.setCellStyle(style);

        workbook.write(fos);
        fos.flush();
        fos.close();

    }
}
